<?php
$this->breadcrumbs=array(
	'Products'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Product', 'url'=>array('index')),
	array('label'=>'Create Product', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('product-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Quản lý sản phẩm</h1>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('bootstrap.widgets.BootGridView', array(    //bootstrap.widgets.CGridView
	'id'=>'product-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
        	'name'=>'id',
        	'type'=>'raw',
        	'value'=>'$data->id',
        	'htmlOptions'=>array(
            	'style'=>'width:50px;text-align:left;',
			),
		),
		array(
			'header'=>'Chuyên mục',
			'type'=>'raw',
			'value'=>'empty($data->category) ? null : $data->category->name',
		),
		array(
        	'name'=>'name',
        	'type'=>'raw',
        	'value'=>'CHtml::link($data->name, array("/hq/product/view/","id"=>$data->id))'
		),
		array(
        	'name'=>'name_en',
        	'type'=>'raw',
        	'value'=>'CHtml::link($data->name_en, array("/hq/product/view/","id"=>$data->id))'
		),
		'last_modified_time',
		array(
			'class'=>'bootstrap.widgets.BootButtonColumn',
			'htmlOptions'=>array(
            	'style'=>'width:50px;text-align:right;',
			),
		),
	),
)); ?>
